package com.opc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.opc.dto.AbnormalDto;
import com.opc.dto.DeviceRecordTimesDto;
import com.opc.dto.HistoryRecordDto;
import com.opc.entity.DeviceRecord;
import com.opc.excel.HistoryExcel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 作者
 * @since 2023-03-14
 */
@Mapper
public interface DeviceRecordMapper extends BaseMapper<DeviceRecord> {

    DeviceRecord selectLatestRecordByDcAndType(@Param("deviceCode") String deviceCode, @Param("type") Integer type);

    List<DeviceRecord> selectAllRecordByIds(@Param("paramMap") Map<String, Object> paramMap);

    int updateDeviceRecordByCodesAndType(@Param("paramMap") Map<String, Object> paramMap);

    List<AbnormalDto> getAbnormalStatistic(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    int updateDeviceRecordByIds(@Param("paramMap") Map<String, Object> paramMap);

    List<DeviceRecord> selectConsumeByProLine(@Param("paramMap") Map<String, Object> paramMap);

    List<DeviceRecordTimesDto> selectConsumeByProLineNew(@Param("paramMap") Map<String, Object> paramMap);

    IPage<HistoryRecordDto> getAbnormalHistory(Page<HistoryRecordDto> page, @Param("paramMap") Map<String, Object> paramMap);

    IPage<HistoryRecordDto> getHistoryList(Page<HistoryRecordDto> page, Map<String, Object> paramMap);

    List<HistoryExcel> getHistoryListExcel(@Param("paramMap") Map<String, Object> paramMap);

    List<HistoryRecordDto> getAbnormalHistoryExcel(@Param("paramMap") Map<String, Object> paramMap);

    int delAbnormal(@Param("paramMap") Map<String, Object> paramMap);
}
